<template>
  <div>
<!--    <div>当前最新的count为: {{$store.state.count}} </div>-->
    <h3>{{$store.getters.showNUM}}</h3>
    <button @click="btnHandle1">+1</button>
    <br>
    <button @click="btnHandle2">+N</button>
    <br>
    <button @click="btnHandle3">延迟+1</button>
    <br>
    <button @click="btnHandle4(4)">延迟+N</button>

  </div>
</template>

<script>
export default {
  name: 'Addition',
  data () {
    return {

    }
  },
  methods: {
    btnHandle1 () {
      this.$store.commit('add')
    },
    btnHandle2 () {
      this.$store.commit('addN', 3)
    },
    btnHandle3 () {
      this.$store.dispatch('addAsync')
    },
    btnHandle4 (step) {
      this.$store.dispatch('addNAsync', step)
    }
  }
}
</script>

<style lang="less" scoped></style>
